/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.zx.course.study.entity;

import java.util.Date;

import com.jeesite.common.utils.excel.annotation.ExcelField;
import com.jeesite.common.utils.excel.annotation.ExcelFields;
import com.jeesite.common.utils.excel.fieldtype.OfficeType;
import com.jeesite.modules.sys.entity.Office;
import org.hibernate.validator.constraints.Length;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.common.utils.excel.annotation.ExcelField;
import com.jeesite.common.utils.excel.annotation.ExcelFields;
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
import com.jeesite.modules.sys.entity.EmpUser;
import com.jeesite.modules.zx.course.entity.Tcourses;

import javax.validation.Valid;

/**
 * 课程学习表Entity
 * @author zpp
 * @version 2020-02-11
 */
@Table(name="t_course_study", alias="a", columns={
		@Column(name="id", attrName="id", label="主键", isPK=true),
		@Column(name="course_id", attrName="courseId", label="课程主键"),
		@Column(name="course_title", attrName="courseTitle", label="课程标题"),
		@Column(name="course_hourse_id", attrName="courseHourseId", label="课时标识"),
		@Column(name="user_id", attrName="userId", label="用户主键"),
		@Column(name="duration", attrName="duration", label="视频播放时长"),
		@Column(name="play_date", attrName="playDate", label="播放时间"),
		@Column(name="pause_date", attrName="pauseDate", label="暂停时间"),
		@Column(name="difference", attrName="difference", label="差别"),
		@Column(name="pause_time", attrName="pauseTime", label="暂停时播放时间"),
		@Column(name="finish", attrName="finish", label="是否学完课时"),
		@Column(includeEntity=DataEntity.class),
	},joinTable={
			@JoinTable(type=Type.LEFT_JOIN, alias = "e", attrName="empUser", entity = EmpUser.class, on = "a.user_id=e.user_code",columns={
				@Column(name="user_code"),
				@Column(name="user_name"),
				@Column(name="mobile"),
			}),
			@JoinTable(type=Type.LEFT_JOIN, alias = "c", attrName="courses", entity = Tcourses.class, on = "a.course_id=c.id",columns={
					@Column(name="id"),
					@Column(name="course_title"),
				}),
			@JoinTable(type=Type.LEFT_JOIN, alias = "cc", attrName="courseHour", entity = Tcourses.class, on = "a.course_hourse_id=cc.id",columns={
					@Column(name="id"),
					@Column(name="course_title"),
				})
	}, orderBy="a.update_date DESC"
)
public class ZxCourseStudy extends DataEntity<ZxCourseStudy> {
	
	private static final long serialVersionUID = 1L;
	private String courseId;		// 课程主键
	private String userId;		// 用户主键
	private Double pauseTime;
	private String difference;
	private String pauseDate;
	private String playDate;
	private Double duration;
	private String courseHourseId;
	private String courseTitle;
	private Integer finish;
	private EmpUser empUser=new EmpUser();
	private Tcourses courses=new Tcourses();
	private Tcourses courseHour=new Tcourses();
	private String firstOffice; //一级 
	private String secondOffice; //二级
    private String officeName;//归属机构编码
    @Valid
    @ExcelFields({
    	@ExcelField(title="课程名称", attrName="courses.courseTitle", align=Align.CENTER, sort=10,  type=ExcelField.Type.EXPORT),
    	@ExcelField(title="课时名称", attrName="courseHour.courseTitle", align=Align.CENTER, sort=20,  type=ExcelField.Type.EXPORT),
    	@ExcelField(title="一级机构", attrName="firstOffice", align=Align.CENTER, sort=30,  type=ExcelField.Type.EXPORT),
    	@ExcelField(title="二级机构", attrName="secondOffice", align=Align.CENTER, sort=40,  type=ExcelField.Type.EXPORT),
    	@ExcelField(title="归属机构", attrName="officeName", align=Align.CENTER, sort=50,  type=ExcelField.Type.EXPORT),
    	@ExcelField(title="用户名称", attrName="empUser.userName", align=Align.CENTER, sort=60,  type=ExcelField.Type.EXPORT),
    	@ExcelField(title="手机号", attrName="empUser.mobile", align=Align.CENTER, sort=70,  type=ExcelField.Type.EXPORT),
    	@ExcelField(title="学习时间", attrName="playDate", align=Align.CENTER, sort=80,  type=ExcelField.Type.EXPORT),
    	@ExcelField(title="学习时长", attrName="duration", align=Align.CENTER, sort=90,  type=ExcelField.Type.EXPORT),
    	@ExcelField(title="是否学完", attrName="finish", align=Align.CENTER, sort=100,  type=ExcelField.Type.EXPORT),
    })
	public String getFirstOffice() {
		return firstOffice;
	}

	public void setFirstOffice(String firstOffice) {
		this.firstOffice = firstOffice;
	}

	public String getSecondOffice() {
		return secondOffice;
	}

	public void setSecondOffice(String secondOffice) {
		this.secondOffice = secondOffice;
	}

	public String getOfficeName() {
		return officeName;
	}

	public void setOfficeName(String officeName) {
		this.officeName = officeName;
	}

	public Integer getFinish() {
		return finish;
	}

	public void setFinish(Integer finish) {
		this.finish = finish;
	}

	public Tcourses getCourseHour() {
		return courseHour;
	}

	public void setCourseHour(Tcourses courseHour) {
		this.courseHour = courseHour;
	}

	public Tcourses getCourses() {
		return courses;
	}

	public void setCourses(Tcourses courses) {
		this.courses = courses;
	}

	public EmpUser getEmpUser() {
		return empUser;
	}

	public void setEmpUser(EmpUser empUser) {
		this.empUser = empUser;
	}

	public Double getPauseTime() {
		return pauseTime;
	}

	public void setPauseTime(Double pauseTime) {
		this.pauseTime = pauseTime;
	}

	public String getDifference() {
		return difference;
	}

	public void setDifference(String difference) {
		this.difference = difference;
	}

	public String getPauseDate() {
		return pauseDate;
	}

	public void setPauseDate(String pauseDate) {
		this.pauseDate = pauseDate;
	}

	public String getPlayDate() {
		return playDate;
	}

	public void setPlayDate(String playDate) {
		this.playDate = playDate;
	}

	public Double getDuration() {
		return duration;
	}

	public void setDuration(Double duration) {
		this.duration = duration;
	}

	public String getCourseHourseId() {
		return courseHourseId;
	}

	public void setCourseHourseId(String courseHourseId) {
		this.courseHourseId = courseHourseId;
	}

	public String getCourseTitle() {
		return courseTitle;
	}

	public void setCourseTitle(String courseTitle) {
		this.courseTitle = courseTitle;
	}

	public ZxCourseStudy() {
		this(null);
	}

	public ZxCourseStudy(String id){
		super(id);
	}
	
	@Length(min=0, max=50, message="课程主键长度不能超过 50 个字符")
	public String getCourseId() {
		return courseId;
	}

	public void setCourseId(String courseId) {
		this.courseId = courseId;
	}
	
	@Length(min=0, max=64, message="用户主键长度不能超过 64 个字符")
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}
	
}